<!DOCTYPE html>
<html>
<head>
    {include file="public/header" /}
</head>
<body>
<div style="padding-bottom:200px" class="layui-form layuimini-form">

    <input type="hidden" name="id" value="{$res.id}" />
    <input type="hidden" name="bizpro_id" value="{$res.bizpro_id}" />
    <div class="layui-form-item">
        <label class="layui-form-label required">名称</label>
        <div class="layui-input-block">
            <input type="text"  value="{$res.title}" name="title" lay-verify="required" lay-reqtext="名称不能为空" placeholder="请输入名称"  class="layui-input">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label required">答案</label>
        <div class="layui-input-block">
            <input type="text"  value="{$res.params}" name="params" lay-verify="required" lay-reqtext="答案不能为空" placeholder="请输入答案"  class="layui-input">
        </div>
    </div>

    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn layui-btn-normal" lay-submit lay-filter="saveBtn">确认保存</button>
        </div>
    </div>
    <!--</form>-->
</div>
{include file="public/footer" /}
<script>

    layui.use(['form','laydate','table'], function () {
        let form = layui.form,
            layer = layui.layer,
            $ = layui.$;

        // laydate.render({elem: '#end_time'});
        //监听提交
        form.on('submit(saveBtn)', function (data) {
            //发异步，把数据提交给php
            $.ajax({
                url: '/admin/bizpro/DoSaveParam?action=ajax',
                type: 'post',
                dataType: 'json',
                data:data.field,
                success: function(res) {
                    if (res.status == true) {
                        layer.msg('保存成功', {icon: 1, time: 1000},
                            function(){
                            console.log(parent)
                                return false
                                parent.location.reload();
                            })

                    }  else {
                        layer.open({
                            title: '错误信息',
                            content: '<span style="color:red">'+res.code+':</span>'+res.msg
                        })
                        return false
                    }
                },
                error: function(re) {

                    layer.open({
                        title: '错误信息',
                        content: '<span style="color:red">'+re.responseJSON.errorCode+':</span>'+re.responseJSON.msg
                    })
                }
            });




        });



    });











</script>
</body>
</html>